package com.dong.collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * description
 *
 * @author Administrator 2021/08/26 18:04
 */
public class ArrayListTest {

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);

        List<Integer> subList = list.subList(1,list.size());
        Iterator <Integer> iterator = subList.iterator();
        while(iterator.hasNext()){
            Integer temp = iterator.next();
            System.out.println(temp);
        }
        for (Integer integer : subList){
            if (integer == 3){
                subList.set(1,5);
                break;
            }
        }
        System.out.println(subList);
        System.out.println(list);
    }
}
